#include "debug.h"
#include "Elements\\ElementManager.h"

using namespace SDL::UTILS;

NS_BEGIN(SDL)
NS_BEGIN(ELEMENTS)

#pragma region ElementArgs

ElementArgs::ElementArgs(SDL_Surface* _screen, SDL_Event* _event)
	: IArgs(), Screen(_screen), Event(_event)
{
	CTOR("ElementArgs", this);
}

ElementArgs::ElementArgs(ElementArgs const&)
{
}

ElementArgs::~ElementArgs()
{
	DTOR("ElementArgs", this);
}

ElementArgs& ElementArgs::operator=(ElementArgs const&)
{
	return (*this);
}

#pragma endregion
#pragma region ElementManager
#pragma region CTOR & DTOR

ElementManager::ElementManager()
{
	CTOR("ElementManager", this);
}

ElementManager::ElementManager(ElementManager const&)
{
}

ElementManager::~ElementManager()
{
	DTOR("ElementManager", this);
}

#pragma endregion
#pragma region Operators

ElementManager& ElementManager::operator=(ElementManager const&)
{
	return (*this);
}

#pragma endregion

void ElementManager::Manage(IArgs* _args)
{
	ElementArgs* ea = (ElementArgs*)_args;
	Elements::iterator it = m_elements.begin();
	for (; it != m_elements.end(); ++it)
	{
		if (it->second.second != NULL)
			it->second.second(it->second.first, _args);
		it->second.first->Object->Draw(ea->Screen);
	}
}

#pragma endregion

NS_END(ELEMENTS)
NS_END(SDL)
